package com.blank.shop.config.client;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author _blank
 * RefreshScope 必须post  http://当前项目/actuator/refresh
 */
@RefreshScope
@RestController

@SpringBootApplication
public class ShopConfigClientApplication {

    /**
     * 此数据是从git上面读取到的
     */
    @Value("${filename}")
    private String gitFilename;

    public static void main(String[] args) throws Exception {
        SpringApplication.run(ShopConfigClientApplication.class, args);
    }

    @GetMapping(path = {"/"})
    public ResponseEntity<String> getGitConfigInfo() {
        return ResponseEntity.ok(this.gitFilename);
    }

}
